<div class="card bg-light mb-3 w-100">
    <div class="card-body">
        {# 收藏功能 #}
        {% if current_user.is_authenticated %}
            {% if current_user.is_collecting(post) %}
                <form class="inline" method="post"
                      action="{{ url_for('main.uncollect', post_id=post.id) }}">
                    <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
                    <button type="submit" class="btn btn-outline-secondary btn-sm">
                        <span class="oi oi-x"></span> 取消收藏
                    </button>
                </form>
            {% else %}
                <form class="inline" method="post"
                      action="{{ url_for('main.collect', post_id=post.id) }}">
                    <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
                    <button type="submit" class="btn btn-outline-primary btn-sm">
                        <span class="oi oi-star"></span> 收藏
                    </button>
                </form>
            {% endif %}
        {% else %}
            <form class="inline" method="post" action="{{ url_for('main.collect', post_id=post.id) }}">
                <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
                <button type="submit" class="btn btn-primary btn-sm">
                    <span class="oi oi-star"></span> 收藏
                </button>
            </form>
        {% endif %}
        {# 展示照片的收藏者#}
        {% if post.collectors %}
            <a href="{{ url_for('main.show_collectors', post_id=post.id) }}">&nbsp;
                收藏者({{ post.collectors|length }})</a>
        {% endif %}
    </div>
</div>
